package cn.itcast.order.mapper;

import cn.itcast.order.pojo.Order;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface OrderMapper extends BaseMapper<Order> {

    @Select("select * from order_tbl where id = #{id}")
    Order findById(Long id);

    @Insert("insert into order_tbl(user_id,commodity_code,count,money) values(#{userId}, #{commodityCode}, #{count}, #{money})")
    Boolean insertOrder(Order order);

    @Update("update order_tbl set state=#{state} where id = #{id}")
    Boolean updateOrderState(long id, int state);
}
